<template>
    <div class="app-container">
        <div class="search-wrapper">
            <el-form :inline="true" class="demo-form-inline">
                <el-form-item label="设备编号">
                    <el-input
                        v-model="queryConditions.pro_equipment_code"
                        placeholder="请输入设备编号"
                    ></el-input>
                </el-form-item>
                <el-form-item label="设备名称">
                    <el-input
                        v-model="queryConditions.pro_equipment_name"
                        placeholder="请输入设备名称"
                    ></el-input>
                </el-form-item>
                <el-form-item label="工位外键">
                    <el-input
                        v-model="queryConditions.fk_station_id"
                        placeholder="请输入工位外键"
                    ></el-input>
                </el-form-item>
                <el-form-item label="创建时间">
                    <el-date-picker
                        v-model="queryConditions.timeRange"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                    >
                    </el-date-picker>
                </el-form-item>
            </el-form>
            <el-form :inline="true" class="demo-form-inline">
                <el-form-item label="项目外键">
                    <el-input
                        v-model="queryConditions.fk_project_id"
                        placeholder="请输入项目外键"
                    ></el-input>
                </el-form-item>
                <el-form-item label="项目工位绑定外键">
                    <el-input
                        v-model="queryConditions.fk_pro_sta_id"
                        placeholder="请输入项目工位绑定外键"
                    ></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary">搜索</el-button>
                    <el-button @click="handleReset">重置</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div class="list-wrapper">
            <div class="content">
                <div class="title">
                    <span>设备管理</span>
                </div>
                <div class="operation">
                    <el-button type="primary" @click="handleAdd"
                        >新增</el-button
                    >
                </div>
                <comm-table
                    ref="comm-table"
                    :loading="loading"
                    :data="tableData"
                    @selection-change="selectionChange"
                    style="width: 100%"
                >
                    <el-table-column width="80" type="selection" />
                    <el-table-column
                        prop="pro_equipment_code"
                        label="设备编号"
                        width="180"
                    />
                    <el-table-column
                        prop="pro_equipment_name"
                        label="设备名称
"
                        width="180"
                    />
                    <el-table-column prop="fk_station_id" label="工位外键" />
                    <el-table-column prop="fk_project_id" label="项目外键" />
                    <el-table-column
                        prop="fk_pro_sta_id"
                        label="项目工位绑定外键"
                    />
                    <el-table-column prop="beginTime" label="创建开始时间" />
                    <el-table-column prop="endTime" label="创建结束时间" />
                </comm-table>
            </div>
        </div>
        <el-dialog
            :visible="dialogVisible"
            :title="title"
            @close="dialogVisible = false"
        >
            <AddMachine ref="addDialog" />
            <div class="dialog-footer">
                <el-button @click="handleConfirm" type="primary"
                    >确认</el-button
                >
                <el-button>取消</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import AddMachine from "../modules/add-machine";
import TableCommMixin from "@/mixins/TableCommMixin";
import { postAction, getAction } from "@/api/manage";
export default {
    name: "Machine",
    mixins: [TableCommMixin],
    components: { AddMachine },
    data() {
        return {
            queryConditions: {
                pro_equipment_code: "",
                timeRange: "",
                pro_equipment_name: "",
                fk_station_id: "",
                fk_project_id: "",
                fk_pro_sta_id: ""
            },
            url: {
                list: "/material/api/MesProEquipment",
                add: "/material/api/MesProEquipment",
                addMethod: "post",
                edit: "/material/api/MesProEquipment",
                editMethod: "put",
                delete: "/material/api/MesProEquipment"
            }
        };
    },
    created() {
        let machine_id = this.$route.query["machine_id"];
        this.queryConditions["fk_project_id"] = machine_id;
        this.getList();
    },
    methods: {},
    mounted() {}
};
</script>
